/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.member;

import com.enation.app.javashop.client.member.ShipTemplateClient;
import com.enation.app.javashop.core.client.fallback.member.ShipTemplateClientFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.shop.vo.ShipTemplateVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * @version v7.0
 * @Description: 店铺运费模版Client默认实现
 * @Author: zjp
 * @Date: 2018/7/25 16:20
 */
@FeignClient(name = "member-service", fallbackFactory = ShipTemplateClientFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface ShipTemplateClientFeignImpl extends ShipTemplateClient {
    /**
     * 获取运费模版
     *
     * @param id 运费模版主键
     * @return ShipTemplate  运费模版
     */
    @Override
    @RequestMapping(value = "/client/ship-template/{id}", method = RequestMethod.GET)
    ShipTemplateVO get(@PathVariable("id") Long id);

    /**
     * 获取运费模板的脚本
     * @param id
     * @return
     */
    @Override
    @RequestMapping(value = "/client/ship-template/{id}/scripts", method = RequestMethod.GET)
    List<String> getScripts(@PathVariable("id") Long id);

    /**
     * 新增运费模板的时候，生成script缓存到redis
     *
     * @param shipTemplateVO 运费模板
     */
    @Override
    @RequestMapping(value = "/client/ship-template/scripts", method = RequestMethod.POST)
    void cacheShipTemplateScript(@RequestBody ShipTemplateVO shipTemplateVO);

}
